/**
 * Package:com.afteryuan.util.code;
 * $Id$
 * Copyright(c) 2001-2005 www.afteryuan.com
 */
package com.afteryuan.util.code;

import com.afteryuan.util.FileUtil;

import java.util.List;
import java.util.ArrayList;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

import org.apache.commons.io.filefilter.SuffixFileFilter;

/**
 * GenerateCode
 * <p/>
 * <p><a href="GenerateCode.java.html"><i>View Source</i></a></p>
 *
 * @author <a href="mailto:afteryuan@afteryuan.com">$Author$</a>
 * @version $Revision$
 */
public class GenerateCode {
    public static void main(String[] args) throws IOException {
        String modelPath = "D:/Project/toucan/src/java/com/kmpro/model";
        String srcPath = "D:/Project/toucan/src/java";
        String testPath = "D:/Project/toucan/test/testCase";
        List<File> models = new ArrayList<File>();
        FileUtil.listAllFile(modelPath,models,new FileFilter() {
            public boolean accept(File pathname) {
                if(pathname.getName().indexOf("BaseObject")>=0)return false;
                if(pathname.getPath().indexOf("svn")>=0)return false;
                if(pathname.getName().indexOf(".java")>=0)return true;
                return false;
            }
        });
        for (File model : models) {
            //new ServiceGenerator(model,new File(srcPath)).generate();
            new ServiceImplGenerator(model,new File(srcPath)).generate();
            new ServiceTestGenerator(model,new File(srcPath),new File(testPath)).generate();
        }
    }
}
